﻿Imports System.Data.OracleClient
Namespace persistent

    Public Class LAPoful
        Private Shared ConnStr As String = GlobalVar.OraConnStr
        Private Shared dbPackageName As String = "eu_bill.Lapoful."
        Public Shared Function GetCustomerInfoFromCustcode(ByVal pin_custcode As String) As DataTable
            Dim command As New OracleCommand(dbPackageName & "GetCustomerInfoFromCustcode")
            command.Parameters.Add("pin_custcode", OracleType.VarChar).Value = pin_custcode
            command.Parameters.Add("p_cursor", OracleType.Cursor).Direction = ParameterDirection.Output 'Customer ID Bilgisinin Databaseden Alınması  
            'LOGLAMA 
            Dim Query As String = "Select * from dual "
            Dim gen As Object = New NetworkRequestViewDelete()
            persistent.myDBConn.ORAScalar_LOG(Query, pin_custcode, "null", "null", "null", "Select(GetCustomerInfoFromCustcode)", "LAPoful", gen.Session("user"))

            Return ExecuteDataTable(command)
        End Function
        Public Shared Function CustomerInfoFromCustcode(ByVal pin_custcode As String) As DataTable
            Dim command As New OracleCommand(dbPackageName & "CustomerInfoFromCustcode")
            command.Parameters.Add("pin_custcode", OracleType.VarChar).Value = pin_custcode
            command.Parameters.Add("p_cursor", OracleType.Cursor).Direction = ParameterDirection.Output 'Customer ID Bilgisinin Databaseden Alınması  
            'LOGLAMA 
            Dim Query As String = "Select * from dual "
            Dim gen As Object = New NetworkRequestViewDelete()
            persistent.myDBConn.ORAScalar_LOG(Query, pin_custcode, "null", "null", "null", "Select(CustomerInfoFromCustcode)", "LAPoful", gen.Session("user"))

            Return ExecuteDataTable(command)
        End Function
        Public Shared Function RpeList() As DataTable
            Dim command As New OracleCommand(dbPackageName & "RpePackList")
            command.Parameters.Add("p_cursor", OracleType.Cursor).Direction = ParameterDirection.Output 'Customer ID Bilgisinin Databaseden Alınması  
            Return ExecuteDataTable(command)
        End Function
        Public Shared Function ReasonList() As DataTable
            Dim command As New OracleCommand(dbPackageName & "ReasonStatusList")
            command.Parameters.Add("p_cursor", OracleType.Cursor).Direction = ParameterDirection.Output 'Customer ID Bilgisinin Databaseden Alınması  
            Return ExecuteDataTable(command)
        End Function



        Public Shared Function CreatePOFULContract(ByVal pin_CUSTOMER_ID As Integer,ByVal pin_rpe_des As String, ByVal pin_rpe_value As Integer) As DataTable

            Dim command As New OracleCommand(dbPackageName & "CreatePOFULContract")

            command.Parameters.Add("pin_CUSTOMER_ID", OracleType.Int32).Value = pin_CUSTOMER_ID
            'command.Parameters.Add("pin_RPCODE", OracleType.Int32).Value = pin_RPCODE
            'command.Parameters.Add("pin_RS_CODE", OracleType.Int32).Value = pin_RS_CODE
            'command.Parameters.Add("pin_sncode", OracleType.Int32).Value = pin_sncode
            command.Parameters.Add("pin_rpe_des", OracleType.VarChar).Value = pin_rpe_des
            command.Parameters.Add("pin_rpe_value", OracleType.Int32).Value = pin_rpe_value
            command.Parameters.Add("p_cursor", OracleType.Cursor).Direction = ParameterDirection.Output 'Customer ID Bilgisinin Databaseden Alınması 
            'LOGLAMA LAPoful
            Dim Query As String = "Select * from dual "
            Dim gen As Object = New NetworkRequestViewDelete()
            persistent.myDBConn.ORAScalar_LOG(Query, "null", pin_CUSTOMER_ID, "null", "null", "Select(CreatePOFULContract)", "LAPoful", gen.Session("user"))

            Return ExecuteDataTable(command)
        End Function

        Public Shared Function DeletePOFULContract(ByVal pin_user_reason As Integer, ByVal pin_Customer_id As Integer) As DataTable

            Dim command As New OracleCommand(dbPackageName & "DeletePOFULContract")

            command.Parameters.Add("pin_user_reason", OracleType.Int32).Value = pin_user_reason
            'command.Parameters.Add("pin_RPCODE", OracleType.Int32).Value = pin_RPCODE
            'command.Parameters.Add("pin_RS_CODE", OracleType.Int32).Value = pin_RS_CODE
            'command.Parameters.Add("pin_sncode", OracleType.Int32).Value = pin_sncode
            command.Parameters.Add("pin_Customer_id", OracleType.Int32).Value = pin_Customer_id
            command.Parameters.Add("p_cursor", OracleType.Cursor).Direction = ParameterDirection.Output

            'command.Parameters.Add("pin_rpe_value", OracleType.Int32).Value = pin_rpe_value
            'command.Parameters.Add("p_cursor", OracleType.Cursor).Direction = ParameterDirection.Output 'Customer ID Bilgisinin Databaseden Alınması 
            'LOGLAMA 
            'Dim Query As String = "Select * from dual "
            'Dim gen As Object = New NetworkRequestViewDelete()

            'persistent.myDBConn.ORAScalar_LOG(Query, "null", pin_CUSTOMER_ID, "null", "null", "Select(CreatePOFULContract)", "LAPoful", gen.Session("user"))

            Return ExecuteDataTable(command)
        End Function

        Public Shared Function ExecuteDataTable(ByVal command As OracleCommand, Optional ByVal directSql As Boolean = 0) As DataTable
            Dim connection As New OracleConnection(ConnStr)
            Dim dataAdapter As New OracleDataAdapter(command)
            Dim dataTable As New DataTable
            Dim dataSet As New DataSet

            command.Connection = connection

            If Not (directSql) Then
                command.CommandType = CommandType.StoredProcedure
            End If

            Try
                connection.Open()
                dataAdapter.Fill(dataSet)
                dataTable = dataSet.Tables(0)
            Catch ex As Exception
            Finally
                connection.Close()
                dataSet.Dispose()
            End Try

            Return dataTable
        End Function





     



    End Class
End Namespace

